package cn.dansj.common.utils.bean;

import java.util.Arrays;

public class CacheKey {
    private final Object[] params;
    private final int hashCode;

    public CacheKey(Object... params) {
        this.params = params;
        this.hashCode = Arrays.deepHashCode(params);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        CacheKey cacheKey = (CacheKey) o;
        return Arrays.deepEquals(params, cacheKey.params);
    }

    @Override
    public int hashCode() {
        return hashCode;
    }
}